import http from '@/utils/axios';

// 获取列表数据
export const getConfigListApi = (params: any) => {
    return http({
        method: 'get',
        url: '/sys_config/index',
        params,
    });
};

// 通过分组ID获取配置表单
export const getConfigFormListApi = (params: any) => {
    return http({
        method: 'get',
        url: '/sys_config/getConfigFormList',
        params
    });
};

// 获取数据
export const getConfigInfoApi = (id: number) => {
    return http({
        method: 'GET',
        url: `/sys_config/read/${id}`,
    });
};

// 获取配置数据
export const getConfigApi = (mark: string) => {
    return http({
        method: 'GET',
        url: `/sys_config/getConfig/${mark}`,
    });
};

// 新增数据
export const saveConfigInfoApi = (data: any) => {
    return http({
        method: 'POST',
        url: `/sys_config/save`,
        data,
    });
};

// 更新数据
export const updateConfigInfoApi = (id: number, data: any) => {
    return http({
        method: 'PUT',
        url: `/sys_config/update/${id}`,
        data,
    });
};

// 更新配置值
export const updateConfigValueApi = (data) => {
    return http({
        method: 'POST',
        url: `/sys_config/updateConfigValue`,
        data,
    });
};

// 删除数据
export const deleteConfigInfoApi = (id: number)=> {
    return http({
        method: 'DELETE',
        url: `/sys_config/delete/${id}`,
    });
};